#include <boost/shared_ptr.hpp>

struct A
{
   virtual int getValue()=0;
};


struct B : public A
{ 
   int getValue()
   { return 21; }
};


boost::shared_ptr<A> factory()
{
   return boost::shared_ptr<B>(new B);
}


